package com.itlong.cloud.property.dao;

import com.itlong.cloud.POJO.PO.DeviceBusinessChangeLogPO;
import com.itlong.cloud.abstracts.IAbstractBaseDao;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.Map;

/**
 * <desc>
 *      设备硬件指令持久层对象
 * </desc>
 *
 * @createDate 2017/9/21
 */
@Mapper
@Repository
public interface IDeviceBusinessChangeLogDao extends IAbstractBaseDao<DeviceBusinessChangeLogPO> {

    /**
     * <desc>
     *      添加硬件推送指令
     * <desc/>
     * @param  params     bean转换成map后参数集
     * @return
     * @author Biao.R
     * @createDate 2017/9/25
     */
    Integer save(Map<String,Object> params);


    /**
     * <desc>
     *      批量添加硬件推送指令
     * <desc/>
     * @param  params     bean转换成map后参数集
     * @return
     * @author Biao.R
     * @createDate 2017/9/28
     */
    Integer batchSave(List<Map<String,Object>> params);


    /**
     * <desc>
     *      根据字段参数查找推送指令
     * <desc/>
     * @param   params  查询参数集
     * @return  List<DeviceBusinessChangeLogPO>  返回PO对象集
     * @author Biao.R
     * @createDate 2017/10/31
     */
    List<DeviceBusinessChangeLogPO> getByParams(Map<String, Object> params);


    /**
     * <desc>
     *     云对讲_批量保存设备端推送指令
     * </desc>
     * @param deviceBusinessChangeLogPOList
     * @return
     * @throws Exception
     * @author cuiduanwu
     * @createDate 2017-11-17
     */
    int saveDeviceBusinessChangeLogBatch(List<DeviceBusinessChangeLogPO> deviceBusinessChangeLogPOList);

    /**
     * <desc>
     *      更新状态为已处理
     * </desc>
     *
     * @param ids
     * @return
     * @author Jiaqi.X
     * @createDate 2017/12/04
     */
    Integer updateBusinessStatusSuccess(@Param("projectIds")String[] projectIds,@Param("ids") String[] ids);

    /**
     * <desc>
     *      根据项目id和类型更新同步状态
     * </desc>
     *
     * @param projectId
     * @param type
     * @return
     * @author Jiaqi.X
     * @createDate 2017/12/11
     */
    Integer updateBusinessStatusSuccessByProjectAndType(@Param("projectId") String projectId,@Param("type") Integer type);

    /**
     * <desc>
     *      全量更新
     * </desc>
     *
     * @param projectId  项目id集合
     * @param type 7房间全量 8云对讲业务服务器地址变更
     * @return
     * @author Jiaqi.X
     * @createDate 2017/12/11
     */
    Integer updateBusinessStatusFull(@Param("projectId") String projectId,@Param("type") Integer type);

    /**
     * <desc>
     *      获取待处理的推送指令
     * </desc>
     *
     * @param projectId 项目id
     * @return  type 类型
     * @author Jiaqi.X
     * @createDate 2017/12/04
     */
    List<DeviceBusinessChangeLogPO> getPendingBusiness(@Param("projectId") String projectId,@Param("type") Integer type);
}
